home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / kernserv / sched_prim.h < prev   
C/C++ Source or Header  |  1995-02-14  |  3KB  |  114 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * Copyright (c) 1987 Carnegie-Mellon University
  6.  * All rights reserved.  The CMU software License Agreement specifies
  7.  * the terms and conditions for use and redistribution.
  8.  */
  9. /*
  10.  * HISTORY
  11.  * $Log:    sched_prim.h,v $
  12.  * 19-Apr-90  Gregg Kellogg (gk) at NeXT
  13.  *    NeXT: Declared thread_wait_result() proecedure.
  14.  *
  15.  * Revision 2.9  89/10/11  14:25:14  dlb
  16.  *     thread_switch --> thread_run.
  17.  *     [89/09/01  17:41:25  dlb]
  18.  * 
  19.  * Revision 2.8  89/10/03  19:26:08  rpd
  20.  *     Defined thread_wakeup, thread_wakeup_with_result, and
  21.  *     thread_wakeup_one using thread_wakeup_prim.
  22.  *     [89/09/01  01:30:53  rpd]
  23.  * 
  24.  * Revision 2.7  89/03/09  20:15:35  rpd
  25.  *     More cleanup.
  26.  * 
  27.  * Revision 2.6  89/02/26  16:18:04  mrt
  28.  *     changed #ifdef    SCHED_PRIM_H_ to #ifndef
  29.  * 
  30.  * Revision 2.5  89/02/25  18:08:14  gm0w
  31.  *     Kernel code cleanup.
  32.  *     Put entire file under #indef KERNEL.
  33.  *     [89/02/15            mrt]
  34.  * 
  35.  * Revision 2.4  89/02/07  01:04:15  mwyoung
  36.  * Relocated from sys/sched_prim.h
  37.  * 
  38.  * Revision 2.3  88/07/17  18:57:09  mwyoung
  39.  * Added thread_wakeup_with_result routine; thread_wakeup
  40.  * is a special case.
  41.  *
  42.  * 16-May-88  Michael Young (mwyoung) at Carnegie-Mellon University
  43.  *    Added thread_wakeup_with_result routine; thread_wakeup
  44.  *    is a special case.
  45.  *
  46.  * 16-Apr-88  Michael Young (mwyoung) at Carnegie-Mellon University
  47.  *    Added THREAD_RESTART wait result value.
  48.  *
  49.  * 29-Feb-88  David Black (dlb) at Carnegie-Mellon University
  50.  *    thread_setrun is now a real routine.
  51.  *
  52.  * 13-Oct-87  David Golub (dbg) at Carnegie-Mellon University
  53.  *    Moved thread_will_wait and thread_go to sched_prim_macros.h,
  54.  *    to avoid including thread.h everywhere.
  55.  *
  56.  *  5-Oct-87  David Golub (dbg) at Carnegie-Mellon University
  57.  *    Created.  Moved thread_will_wait and thread_go here from
  58.  *    mach_ipc.
  59.  *
  60.  */
  61. /*
  62.  *    File:    sched_prim.h
  63.  *    Author:    David Golub
  64.  *
  65.  *    Scheduling primitive definitions file
  66.  *
  67.  */
  68.  
  69. #ifndef    _KERN_INTERNAL_SCHED_PRIM_H_
  70. #define _KERN_INTERNAL_SCHED_PRIM_H_
  71.  
  72. /*
  73.  *    Possible results of assert_wait - returned in
  74.  *    current_thread()->wait_result.
  75.  */
  76. #define THREAD_AWAKENED        0        /* normal wakeup */
  77. #define THREAD_TIMED_OUT    1        /* timeout expired */
  78. #define THREAD_INTERRUPTED    2        /* interrupted by clear_wait */
  79. #define THREAD_SHOULD_TERMINATE    3        /* thread should terminate */
  80. #define THREAD_RESTART        4        /* restart operation entirely */
  81.  
  82. /*
  83.  *    Exported interface to sched_prim.c 
  84.  */
  85.  
  86. extern void    sched_init();
  87. extern void    assert_wait();
  88. extern void    clear_wait();
  89. extern void    thread_sleep();
  90. extern void    thread_wakeup();        /* for function pointers */
  91. extern void    thread_wakeup_prim();
  92. extern void    thread_block();
  93. extern void    thread_run();
  94. extern void    thread_set_timeout();
  95. extern void    thread_setrun();
  96.  
  97. #if    NeXT
  98. extern int    thread_wait_result();
  99. #endif    NeXT
  100.  
  101. /*
  102.  *    Routines defined as macros
  103.  */
  104.  
  105. #define thread_wakeup(x)                        \
  106.         thread_wakeup_prim((x), FALSE, THREAD_AWAKENED)
  107. #define thread_wakeup_with_result(x, z)                    \
  108.         thread_wakeup_prim((x), FALSE, (z))
  109. #define thread_wakeup_one(x)                        \
  110.         thread_wakeup_prim((x), TRUE, THREAD_AWAKENED)
  111.  
  112. #endif    _KERN_INTERNAL_SCHED_PRIM_H_
  113.  
  114.